package bcit.nxt.mission;

// SimEx7.java
// One light sensor, event driven

import gin.and.tonic.*;

public class SimEx7 implements LightListener
{
  private Gear gear = new Gear(MotorPort.B,MotorPort.C);

  public SimEx7()
  {
    NxtRobot robot = new NxtRobot();
    LightSensor ls = new LightSensor(SensorPort.S3);
    robot.addPart(gear);
    robot.addPart(ls);
    ls.addLightListener(this, 300);
    ls.activate(true);
    gear.forward();
  }

  public void bright(SensorPort port, int level)
  {
    gear.rightArc(0.05);
  }

  public void dark(SensorPort port, int level)
  {
    gear.leftArc(0.05);
  }

  public static void main(String[] args)
  {
    new SimEx7();
  }

 
}
